@extends('admin.index')
@section('title','用户列表')
 @section('con')
 <div class="panel-body">
     <div class="dataTable_wrapper">
         <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
             
             <form action="/admin/type/videoindex" method="get">
             <div class="row">
                <div class="col-sm-6">
                    <div class="num" id="dataTables-example_length">
                    <label>显示 <select name="dataTables-example_length" aria-controls="dataTables-example" class="form-control input-sm">
                    <option value="10">10</option>
                    <option value="25">25</option>
                    <option value="50">50</option>
                    <option value="100">100</option>
                    </select> 条</label>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div id="dataTables-example_filter" class="dataTables_filter">
                        <label>电影名:<input name="keyword" type="search" class="form-control input-sm" placeholder="" aria-controls="dataTables-example">
                        <button class="btn btn-info">搜索</button></label>
                    </div>
                </div>
             </div>
             </form>
      <div class="row">
       <div class="col-sm-12">
         <table id="dataTables-example" class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="dataTables-example_info">
             <thead>
                 <tr role="row">
                 <th class="sorting_asc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 60px;" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">ID</th>
                 <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 60px;" aria-label="Browser: activate to sort column ascending">分类名</th>
                 <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 110px;" aria-label="CSS grade: activate to sort column ascending">电影名</th>
                 <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 110px;" aria-label="CSS grade: activate to sort column ascending">付费</th>
                 <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 110px;" aria-label="CSS grade: activate to sort column ascending">播放</th>
                 <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 100px;" aria-label="CSS grade: activate to sort column ascending">操作</th>
                 </tr>
             </thead>
             <tbody>
             @foreach($types as $k=>$v)
                <tr class="gradeA odd" role="row">
                     <td class="sorting_1">{{$v->id}}</td>
                     <td>{{$v->type}}</td>
                     <td>{{$v->film}}</td>
                     <td>{{($v->vips=='0')?'免费':'收费'}}</td>
                     <td><video controls="" src="{{$v->upload}}" width='150px' height='100px'></video></td>
                     <td class="center">
                         <a href="">展示</a>|
                         <a href="" class='delUser' sid='{{$v->id}}'>删除</a>|
                         <a href="/admin/type/videoup?id={{$v->id}}">修改</a>
                     </td>
                </tr>
             @endforeach  
            </tbody>
         </table>
     </div>
    </div>
         <div class="row">
             <div class="col-sm-6">
                 <!-- <div class="dataTables_info" id="dataTables-example_info" role="status" aria-live="polite">Showing 1 to 25 of 57 entries</div> -->
             </div>
             <div class="col-sm-6">

                {!! $types->appends($all)->render() !!}
             </div>
         </div>
         </div>
     </div>
     
 </div>
 @endsection
 @section('js')
    <script type="text/javascript">
        $('.delUser').click(function(){
            //获取id
            var id = $(this).attr('sid');
            var bb = $(this);
            
             $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
                });
            //发送post请求
            $.post('/admin/type/videodel',{id:id},function(data){
                if(data == 1){

                    //删除单条信息
                    bb.parents('tr').remove();

                    //获取提醒信息
                    $('#successMessage').text('视频删除成功').show(1000);
                        //定时关闭消息
                        setTimeout(function(){
                            $('#successMessage').hide(1000);
                        },2000);

                }
            });
            return false;
        })
    </script>
 @endsection

